Skip to content

Create Distcheck#3

Open
eduardomoralesmartines618-pixel wants to merge 1 commit intocgoesche:masterfrom
eduardomoralesmartines618-pixel:eduardomoralesmartines618-pixel-patch-1
Open

Create Distcheck#3
eduardomoralesmartines618-pixel wants to merge 1 commit intocgoesche:masterfrom
eduardomoralesmartines618-pixel:eduardomoralesmartines618-pixel-patch-1

Conversation

@eduardomoralesmartines618-pixel
Copy link
Copy Markdown

graph TD
A[🚀 EVENTO: Push o Pull Request] --> B{¿Es documentación?}
B -->|SÍ| C[⏭️ Ignorar / No compilar]
B -->|NO| D[🔄 INICIAR PIPELINE]

D --> E[🏗️ JOB: BUILD]
D --> F[📊 JOB: COVERALLS]
D --> G[🛠️ JOB: MESON]
D --> H[📦 JOB: DISTCHECK]
D --> I[⏳ JOB: COMPAT]
D --> J[🖥️ JOB: ARCH]
D --> K[🔌 JOB: OPENWRT]

%% --- DETALLE BUILD ---
E --> E1[📥 Checkout]
E1 --> E2[🛠️ Setup Ubuntu]
E2 --> E3[⚙️ Configure]
E3 --> E4[🧪 Code Check]
E4 --> E5[🏗️ Compilar]
E5 --> E6[✅ Test / Check]
E6 --> E7[📦 Instalar]

%% --- DETALLE OPENWRT ---
K --> K1[📥 Checkout]
K1 --> K2[🛠️ Setup]
K2 --> K3[💾 Ver Cache]
K3 --> K4{¿Existe?}
K4 -->|NO| K5[⬇️ Descargar SDK]
K4 -->|SÍ| K6[⚡ Usar Cache]
K5 --> K7[📂 Extraer .tar.xz]
K7 --> K8[🔧 Configurar]
K6 --> K8
K8 --> K9[🏗️ Make]
K9 --> K10[✅ Verificar]

graph TD
    A[🚀 EVENTO: Push o Pull Request] --> B{¿Es documentación?}
    B -->|SÍ| C[⏭️ Ignorar / No compilar]
    B -->|NO| D[🔄 INICIAR PIPELINE]

    D --> E[🏗️ JOB: BUILD]
    D --> F[📊 JOB: COVERALLS]
    D --> G[🛠️ JOB: MESON]
    D --> H[📦 JOB: DISTCHECK]
    D --> I[⏳ JOB: COMPAT]
    D --> J[🖥️ JOB: ARCH]
    D --> K[🔌 JOB: OPENWRT]

    %% --- DETALLE BUILD ---
    E --> E1[📥 Checkout]
    E1 --> E2[🛠️ Setup Ubuntu]
    E2 --> E3[⚙️ Configure]
    E3 --> E4[🧪 Code Check]
    E4 --> E5[🏗️ Compilar]
    E5 --> E6[✅ Test / Check]
    E6 --> E7[📦 Instalar]

    %% --- DETALLE OPENWRT ---
    K --> K1[📥 Checkout]
    K1 --> K2[🛠️ Setup]
    K2 --> K3[💾 Ver Cache]
    K3 --> K4{¿Existe?}
    K4 -->|NO| K5[⬇️ Descargar SDK]
    K4 -->|SÍ| K6[⚡ Usar Cache]
    K5 --> K7[📂 Extraer .tar.xz]
    K7 --> K8[🔧 Configurar]
    K6 --> K8
    K8 --> K9[🏗️ Make]
    K9 --> K10[✅ Verificar]
cgoesche pushed a commit that referenced this pull request May 5, 2026
While making the priority argument optional for non-prio policies, some
confusing error messages were accidentally exposed to users for cases
that do need a priority argument.

  $ chrt true		#1
  chrt: invalid priority argument: 'true'
  $ chrt 1		#2
  chrt: failed to set pid 0's policy: Operation not permitted
  $ sudo chrt 1		#3
  chrt: no command specified
  $ chrt --other 1	util-linux#4
  chrt: unsupported priority value for the policy: 1: see --max for valid range

The error message #1 is caused by mixing `have_prio' and `need_prio'
together. Therefore, it always tries to parse the first positional
argument as a priority when `--pid' is not given. #2 shows that
set_sched() is meaninglessly called even when too few arguments are
specified.

At first glance, the error message #3 seems to be correct, but it turns
out to be very wrong -- the only positional argument in this case must
be regarded as a command, and commit 223a502 ("chrt: (man,usage)
mark the priority value as optional in the synopses") also clearly
stated the same in the help message and the manual. In other words, util-linux#4
should have tried to execute `1' from PATH.

Fix #1 by decoupling `need_prio' from the priority parsing routine.

Fix #2 by parsing the first argument as a priority only when it's not
the only argument.

Fix #3 and util-linux#4 by consuming optind immediately when parsing priority
argument, instead of postponing it with inconsistent conditions (I have
an intuition that the previous code path was vibe-coded...)

Now #1 returns

  chrt: policy SCHED_RR requires a priority argument

... #2, #3 return

  chrt: no command or priority specified

... and util-linux#4 returns

  chrt: failed to execute 1: No such file or directory

... which are more sensible and helpful.

This doesn't break existing usage patterns:

  $ chrt --other true
  $ chrt --other 0 true
  $ chrt --other 1 true
  chrt: unsupported priority value for the policy: 1: see --max for valid range
  $ chrt --other echo meow
  meow

Fixes: 4c42514 ("chrt: Allow optional priority for non‑prio policies without --pid")
Signed-off-by: Rong Zhang <i@rong.moe>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant